#ifndef __H_VS_NORMAL_MODEL_SHADOW__
#define __H_VS_NORMAL_MODEL_SHADOW__

#include "const_define.fx"
#include "struct_define.fx"
#include "light_calc.fx"
#include "fog_calc.fx"
#include "shadow_calc.fx"

// all texture color.
VSO_PUV VS_NORMAL_SHADOW(VSI_NORMAL IN)
{
	VSO_PUV OUT;
	OUT.position = mul(float4(IN.position, 1.0f), MAT_WORLD_VIEW_PROJ);
	OUT.color = float4(1.0f, 1.0f, 1.0f, 1.0f);
	OUT.texCoord = IN.texCoord;
	OUT.texProj = CalcShadowProjTexCoord(IN.position);
	return OUT;
}

// ambient + diffuse light
VSO_PUV VS_NORMAL_AD_SHADOW(VSI_NORMAL IN)
{
	VSO_PUV OUT;
	OUT.position = mul(float4(IN.position, 1.0f), MAT_WORLD_VIEW_PROJ);
	float3 normal = mul(IN.normal, (float3x3)MAT_WORLD);
	OUT.color = ambientLight + CalcDiffuse(lightDirection, normal, diffuseLight);
	OUT.texCoord = IN.texCoord;
	OUT.texProj = CalcShadowProjTexCoord(IN.position);
	return OUT;
}

// ambient + diffuse + specular light.
VSO_PUV VS_NORMAL_ADS_SHADOW(VSI_NORMAL IN)
{
	VSO_PUV OUT;
	OUT.position = mul(float4(IN.position, 1.0f), MAT_WORLD_VIEW_PROJ);    
	float3 normal = mul(IN.normal, (float3x3)MAT_WORLD);
	float4 diffuse = CalcDiffuse(lightDirection, normal, diffuseLight);
	float4 specular = CalcSpecular(IN.position, normal, specularLight, SHININESS);
	OUT.color = ambientLight + diffuse  + specular;
	OUT.texCoord = IN.texCoord;
	OUT.texProj = CalcShadowProjTexCoord(IN.position);
	return OUT;
}

//-----------------------------------------------------------------------------

// all texture color.
VSO_PUV_FOG VS_NORMAL_FOG_SHADOW(VSI_NORMAL IN)
{
	VSO_PUV_FOG OUT;
	OUT.position = mul(float4(IN.position, 1.0f), MAT_WORLD_VIEW_PROJ);
	OUT.color = float4(1.0f, 1.0f, 1.0f, 1.0f);
	OUT.texCoord = IN.texCoord;
	OUT.fog = calc_normal_fog(IN.position);
	OUT.texProj = CalcShadowProjTexCoord(IN.position);
	return OUT;
}

// ambient + diffuse light
VSO_PUV_FOG VS_NORMAL_AD_FOG_SHADOW(VSI_NORMAL IN)
{
	VSO_PUV_FOG OUT;
	OUT.position = mul(float4(IN.position, 1.0f), MAT_WORLD_VIEW_PROJ);
	float3 normal = mul(IN.normal, (float3x3)MAT_WORLD);
	OUT.color = ambientLight + CalcDiffuse(lightDirection, normal, diffuseLight);
	OUT.texCoord = IN.texCoord;
	OUT.fog = calc_normal_fog(IN.position);
	OUT.texProj = CalcShadowProjTexCoord(IN.position);
	return OUT;
}

// ambient + diffuse + specular light.
VSO_PUV_FOG VS_NORMAL_ADS_FOG_SHADOW(VSI_NORMAL IN)
{
	VSO_PUV_FOG OUT;
	OUT.position = mul(float4(IN.position, 1.0f), MAT_WORLD_VIEW_PROJ);    
	float3 normal = mul(IN.normal, (float3x3)MAT_WORLD);
	float4 diffuse = CalcDiffuse(lightDirection, normal, diffuseLight);
	float4 specular = CalcSpecular(IN.position, normal, specularLight, SHININESS);
	OUT.color = ambientLight + diffuse  + specular;
	OUT.texCoord = IN.texCoord;
	OUT.fog = calc_normal_fog(IN.position);
	OUT.texProj = CalcShadowProjTexCoord(IN.position);
	return OUT;
}

//-----------------------------------------------------------------------------


#endif // __H_VS_NORMAL_MODEL_SHADOW__